package com.cskaoyan.controller.mall;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.vo.mall.IssueListInfo;
import com.cskaoyan.bean.vo.mall.IssueListVo;
import com.cskaoyan.service.mall.IssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Ajun de BBC
 * @Date 2022/7/16 18:52
 * @Version 1.5
 */

@RestController
@RequestMapping("admin/issue")
public class IssueController {

    @Autowired
    IssueService issueService;

    @RequestMapping("list")
    public BaseRespVo issueList(Integer page,Integer limit,String question,String sort,String order){
        IssueListVo issueListVo = issueService.issueList( page, limit,question, sort, order);
        return BaseRespVo.ok(issueListVo,"成功",0);
    }


    @RequestMapping("create")
    public BaseRespVo issueCreate(@RequestBody IssueListInfo info){
        IssueListInfo issueListInfo = issueService.issueCreate(info);
        return BaseRespVo.ok(issueListInfo,"成功",0);
    }


    @RequestMapping("update")
    public BaseRespVo issueUpdate(@RequestBody IssueListInfo info){
        issueService.issueUpdate(info);
        return BaseRespVo.ok(info,"成功",0);
    }

    @RequestMapping("delete")
    public BaseRespVo issueDelete(@RequestBody IssueListInfo info){
        issueService.issueDelete(info);
        return BaseRespVo.ok(null,"成功",0);
    }
}
